#include <stdio.h>

void main()
{
    int x = 1;
    int y = 2;
    inplace_swap(&x,&y);

    int a[] = {1,2,3,4};
    reverse_array(&a,4);
    for (int i = 0; i < 4; i++)
    {
        printf("%d",a[i]);
    }
    
}

void inplace_swap(int *x, int *y)
{
    *y = *x ^ *y;
    *x = *x ^ *y;
    *y = *x ^ *y;
}

void reverse_array(int a[], int cnt)
{
    int first,last;
    for (first = 0,last=cnt-1; first < last; first++,last--)
    {
        inplace_swap(&a[first],&a[last]);
    }
    
}